home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / CrossDOS_Plus.adf / DIAG / Expert_ConfigDisk < prev    next >
Text File  |  1992-09-07  |  12KB  |  518 lines

  1. ;********************************************************************
  2. ;Expert HD configuration script (asks the user for a unit number)
  3. ;********************************************************************
  4.  
  5. ;Version 5.04
  6. ;August 28, 1992
  7.  
  8. ;Important: Before shipping, replace all references to ":" with ":".
  9.  
  10. ;********************************************************************
  11.  
  12. ;SetHD -- place hard drive information (e.g. C=PCC) in the CrossPC tooltypes
  13. ;harddisk -- e.g. PCC
  14. ;pcdir -- directory of CrossPC icon
  15.  
  16. (procedure SetHD
  17.     (
  18.         ;If the user has configured a hard drive during this session,
  19.         ;add an appropriate tooltype.
  20.  
  21.         (if
  22.             (not
  23.                 (= harddisk "")
  24.             )
  25.             (
  26.                 ;Grab the last character of harddisk and place it in hdchar
  27.                 (set hdchar
  28.                     (substr harddisk
  29.                         (-
  30.                             (strlen harddisk)
  31.                             1
  32.                         )
  33.                         1
  34.                     )
  35.                 )
  36.  
  37.                 (if
  38.                     (not
  39.                         (exists
  40.                             (tackon pcdir "CrossPC.info")
  41.                         )
  42.                     )
  43.                     (message "Warning: Can't find CrossPC's icon. CrossPC will not be configured.")
  44.                 )
  45.  
  46.                 (tooltype
  47.                     (dest (tackon pcdir "CrossPC"))
  48.                     (noposition)
  49.                     (settooltype hdchar harddisk)
  50.                 )
  51.             )
  52.         )
  53.     )
  54. )
  55.  
  56. ;********************************************************************
  57.  
  58. ;MountHD -- mount the thing and place junk into s:user-startup
  59. ;harddisk -- e.g. PCC
  60.  
  61. (procedure MountHD
  62.     (
  63.         ;If the user has configured a hard drive during this session,
  64.         ;mount etc.
  65.  
  66.         (if
  67.             (not
  68.                 (= harddisk "")
  69.             )
  70.             (
  71.                 ;Mount the hard drive the user just configured.
  72.  
  73.                 (run
  74.                     (cat @execute-dir
  75.                         (cat "c/mount >nil: devs:DOSDrivers/" harddisk)
  76.                     )
  77.                 )
  78.  
  79.                 ;Install into s:user-startup
  80.  
  81.                 (startup
  82.                     (cat "CrossDOSV5+ - mounting hard drive "
  83.                         (cat harddisk ":")
  84.                     )
  85.                     (prompt "About to add a command in s:user-startup to automatically "
  86.                             "mount the hard drive you configured..."
  87.                     )
  88.                     (help "If you elect not to add the mount command to your user-startup, "
  89.                           "you may mount the drive simply by clicking on its icon."
  90.                     )
  91.                     (command
  92.                         (cat prefix
  93.                             (cat "Mount >nil: DEVS:DOSDrivers/" harddisk)
  94.                         )
  95.                     )
  96.                 )
  97.             )
  98.         )
  99.     )
  100. )
  101.  
  102. ;********************** Configure Hard Disk **************************
  103.  
  104. (procedure ConfigureHardDisk
  105.     (
  106.  
  107.         ;Disallow pretend mode
  108.         (if @pretend
  109.             (
  110.                 (message "Sorry, you can't run the hard drive configuration in "
  111.                          "\"pretend\" mode. Exiting..."
  112.                 )
  113.                 (exit
  114.                     (quiet)
  115.                 )
  116.             )
  117.         )
  118.  
  119.         (if
  120.             (= 0
  121.                 (exists "l:CrossDOSFileSystem")
  122.             )
  123.             (
  124.                 (message "CrossDOS V5 is not currently installed. It must "
  125.                          "be installed before you can configure a hard drive. "
  126.                          "Switching to CrossDOS installation..."
  127.                 )
  128.                 (InstallCrossDOS)
  129.             )
  130.         )
  131.  
  132.         (set opt
  133.             (askchoice
  134.                 (choices "Configure on an Amiga Partition"
  135.                          "Configure a 100% MS-DOS Hard Disk"
  136.                 )
  137.                 (prompt "Please select an option. * Hit HELP for details!!! *")
  138.                 (help "If you wish to create a simulated MS-DOS hard drive "
  139.                       "on one of your Amiga hard drive partitions (note: "
  140.                       "the MS-DOS information will completely wipe out any Amiga "
  141.                       "files on that partition) select \"Configure on an Amiga "
  142.                       "Partition\". If you want to dedicate an entire PHYSICAL "
  143.                       "hard drive (or Syquest or Floptical or...) to storing "
  144.                       "MS-DOS information, select \"Configure a 100% MS-DOS Hard "
  145.                       "Disk\". Note that the configuration utility does not "
  146.                       "support very old controllers such as the Commodore A2090. "
  147.                       "In that case you must configure a MountList \"by hand\"."
  148.                 )
  149.             )
  150.         )
  151.  
  152.         ;Ask for drive prefix
  153.  
  154.         (set driveprefix
  155.             (askstring
  156.                 (default "PC")
  157.                 (prompt "Please enter a prefix to be assigned to the MS-DOS "
  158.                         "device you wish to configure.  A 'C' will be added "
  159.                         "to the end of the device name for you.  Please choose "
  160.                         "a device name that is not already in use.  "
  161.                         "\nPress HELP for details."
  162.                 )
  163.                 (help "You must enter a prefix (which may be any normal "
  164.                       "text, without spaces or any special characters) which will "
  165.                       "be used to access the MS-DOS drive/partition from AmigaDOS. A letter will be "
  166.                       "added by the configuration utility "
  167.                       "to form the complete drive name, as accessed from AmigaDOS. "
  168.                       "The relationship between the AmigaDOS drive name and the "
  169.                       "MS-DOS drive name (accessed by CrossPC or by a real IBM) is very "
  170.                       "simple. The last letter of the AmigaDOS name is the MS-DOS name. "
  171.                       "For example, PCC: refers to MS-DOS drive C:. The prefix to "
  172.                       "enter now would be PC (the default)."
  173.                 )
  174.             )
  175.         )
  176.  
  177.         ;Ask for unit number
  178.  
  179.         (set unitnumber
  180.             (asknumber
  181.                 (default 0)
  182.                 (prompt "Enter the unit number of the hard drive you want to "
  183.                         "configure."
  184.                 )
  185.                 (help "Usually the unit number ranges from 0-6 and corresponds "
  186.                       "to the SCSI device number. It is also possible with most "
  187.                       "hard drive controllers to specify the Logical Unit Number (LUN), "
  188.                       "which is used by some Adaptec controllers, and the board number "
  189.                       "(if you have multiple SCSI adapters from the same manufacturer). "
  190.                       "You should consult the documentation of your controller "
  191.                       "for details."
  192.                 )
  193.             )
  194.         )
  195.  
  196.         ;Create a temporary directory
  197.  
  198.         (makedir "ram:CrossDOSTemp")
  199.  
  200.         (set MountListDir "ram:CrossDOSTemp")
  201.         (makedir MountListDir)
  202.  
  203.         ;Run the ConfigDev program
  204.  
  205.         (if
  206.             (= opt 0)
  207.             (set drivetype "AMIGA")
  208.             (set drivetype "MSDOS")
  209.         )
  210.         (set runargs
  211.             (cat
  212.                 drivetype
  213.                 " -fL:CrossDOSFileSystem"
  214.             )
  215.         )
  216.         (set runargs
  217.             (cat
  218.                 runargs
  219.                 (cat
  220.                     " -t"
  221.                     MountListDir
  222.                 )
  223.             )
  224.         )
  225.         (set runargs
  226.             (cat
  227.                 runargs
  228.                 (cat
  229.                     " -p"
  230.                     driveprefix
  231.                 )
  232.             )
  233.         )
  234.  
  235.         ;Tack on unit number (e.g. -u0)
  236.         (set runargs
  237.             (cat
  238.                 runargs
  239.                 (cat
  240.                     " -u"
  241.                     unitnumber
  242.                 )
  243.             )
  244.         )
  245.  
  246.         (run
  247.             (cat
  248.                 (cat @execute-dir "c/ConfigDisk ")
  249.                 runargs
  250.             )
  251.         )
  252.  
  253.         ;Create icons for the files in MountListDir and copy to DEVS:DOSDrivers
  254.         (set success 0)
  255.         (foreach MountListDir "#?"
  256.             (
  257.                 (set success 1)
  258.                 (set okflag 1)
  259.  
  260.                 ;Check for "floptical" - ignore
  261.  
  262.                 (if
  263.                     (= @each-name "floptical")
  264.                     (set okflag 0)
  265.                 )
  266.  
  267.                 ;Check whether the user already has a mountfile of the same name
  268.                 (if okflag
  269.                     (if
  270.                         (exists
  271.                             (cat
  272.                                 "devs:DOSDrivers/"
  273.                                 @each-name
  274.                             )
  275.                         )
  276.                         (
  277.                             (set okflag
  278.                                 (askbool
  279.                                     (prompt "A file called \"" @each-name
  280.                                             "\" already exists in your DEVS:DOSDrivers "
  281.                                             "directory."
  282.                                     )
  283.                                     (choices "Overwrite"
  284.                                              "Cancel"
  285.                                     )
  286.                                     (help "You may elect to overwrite the mountfile "
  287.                                           "that currently exists, or abort the whole "
  288.                                           "procedure."
  289.                                     )
  290.                                 )
  291.                             )
  292.                         )
  293.                     )
  294.                 )
  295.  
  296.                 (if okflag
  297.                     (
  298.                         (copyfiles
  299.                             (source
  300.                                 (cat
  301.                                     (cat
  302.                                         MountListDir
  303.                                         "/"
  304.                                     )
  305.                                     @each-name
  306.                                 )
  307.                             )
  308.                             (dest "devs:DOSDrivers")
  309.                             (infos)    ;just in case the DOSDrivers directory needs to be created.
  310.                             (newname @each-name)
  311.                         )
  312.                         (copyfiles
  313.                             (source ":PC0.info")
  314.                             (dest "devs:DOSDrivers")
  315.                             (newname (cat @each-name ".info"))
  316.                         )
  317.  
  318.                         ;Determine what default tool to use (c:Mount or
  319.                         ;c:CDMount).
  320.  
  321.                         ;Check to see whether the user has a c:CDMount. If so, set "prefix"
  322.                         ;to "CD".
  323.  
  324.                         (if
  325.                             (exists "c:CDMount")
  326.                             (set prefix "CD")
  327.                         )
  328.  
  329.                         (tooltype
  330.                             (dest
  331.                                 (cat
  332.                                     "devs:DOSDrivers/"
  333.                                     @each-name
  334.                                 )
  335.                             )
  336.                             (noposition)
  337.                             (setdefaulttool
  338.                                 (cat
  339.                                     (cat "c:" prefix)
  340.                                     "Mount"
  341.                                 )
  342.                             )
  343.                             ;Delete the "filesystem=" entry
  344.                             ;Case-sensitive!!! (yet another installer bug)
  345.                             (settooltype "FILESYSTEM")
  346.                         )
  347.                         (set harddisk @each-name)
  348.                     )
  349.                 )
  350.             )
  351.         )
  352.  
  353.         ;Delete the file created by ConfigDisk
  354.         (if success
  355.             (
  356.                 (delete "ram:CrossDOSTemp/floptical")
  357.                 (delete
  358.                     (cat
  359.                         "ram:CrossDOSTemp/"
  360.                         harddisk
  361.                     )
  362.                 )
  363.  
  364.                 ;Ask whether he wants to add this drive to CrossPC's tooltypes. etc
  365.  
  366.                 (MountHD)
  367.                 (if
  368.                     (or
  369.                         (= 1
  370.                             (exists "sys:CrossPC")
  371.                         )
  372.                         (= 1
  373.                             (exists "sys:CrossPC/CrossPC")
  374.                         )
  375.                     )
  376.                     (
  377.                         (if
  378.                             ;File?
  379.                             (= 1
  380.                                 (exists "sys:CrossPC")
  381.                             )
  382.                             (
  383.                                 (set pcdir "sys:")
  384.                                 (SetHD)
  385.                             )
  386.                             (
  387.                                 (set pcdir "sys:CrossPC")
  388.                                 (SetHD)
  389.                             )
  390.                         )
  391.                     )
  392.                     (
  393.                         ;Ask the user whether he wants to set the CrossPC tooltype
  394.                         (if
  395.                             (askbool
  396.                                 (prompt "If you have already installed CrossPC *and* "
  397.                                         "you wish to make the hard drive you configured "
  398.                                         "accessible to CrossPC, select \"Yes\"."
  399.                                 )
  400.                                 (help "If you select \"yes\", the installer will ask you "
  401.                                       "where CrossPC has been installed. The installer "
  402.                                       "will proceed to add a tooltype to the CrossPC icon."
  403.                                 )
  404.                             )
  405.                             (
  406.                                 (set notok 1)
  407.                                 (while notok
  408.                                     (
  409.                                         (set pcdir
  410.                                             (askdir
  411.                                                 (prompt "Select the directory in which you "
  412.                                                         "installed CrossPC."
  413.                                                 )
  414.                                                 (help "The installer will proceed to add a tooltype "
  415.                                                       "to the CrossPC icon."
  416.                                                 )
  417.                                                 (default "sys:")
  418.                                             )
  419.                                         )
  420.                                         (if
  421.                                             (= 1
  422.                                                 (exists
  423.                                                     (tackon pcdir "CrossPC")
  424.                                                 )
  425.                                             )
  426.                                             (
  427.                                                 (SetHD)
  428.                                                 (set notok 0)
  429.                                             )
  430.                                             (
  431.                                                 (message "CrossPC is not in the directory you selected.")
  432.                                             )
  433.                                         )
  434.                                     )
  435.                                 )
  436.                             )
  437.                         )
  438.                     )
  439.                 )
  440.                 (message "Hard drive configuration is completed."
  441.                     "\n\n############  WARNING!!!  ############"
  442.                     "\nDO NOT use our Format command or the Amiga format command "
  443.                     "to format " harddisk ":.  Instead, you must treat the "
  444.                     "hard disk you just configured as an unformatted MS-DOS hard disk.  "
  445.                     "This means you must use the FDISK and FORMAT commands "
  446.                     "provided by MS-DOS to partition and format the hard disk.  "
  447.                     "(Consult your MS-DOS manual about the use of these commands.)  "
  448.                     "Failure to heed this warning may cause unpredictable results."
  449.                 )
  450.             )
  451.             (
  452.                 ;else (not successful)
  453.                 (message "Hard drive configuration was not successful. "
  454.                          "If the configuration window didn't appear, it means (most likely) "
  455.                          "that the unit number you specified doesn't exist."
  456.                 )
  457.             )
  458.         )
  459.  
  460.         ;Delete the temporary directory created by this script
  461.         (delete "ram:CrossDOSTemp")
  462.     )
  463. )
  464.  
  465. ;***************************************************************************
  466. ;***************************** MAIN ****************************************
  467. ;***************************************************************************
  468.  
  469. ;Force user level to 1 or 2. This is unfortuntely required because otherwise
  470. ;we can't present a menu of choices to the user.
  471. (if
  472.     (= @user-level 0)
  473.     (
  474.         (user 1)
  475.         (set @user-level 0)
  476.     )
  477. )
  478.  
  479.  
  480. ;Test whether we can access :l/CrossDOSFileSystem. If not, the user is
  481. ;not running from the product disk - abort.
  482.  
  483. (if
  484.     (not
  485.         (exists ":l/CrossDOSFileSystem")
  486.     )
  487.     (
  488.         (message "You must run the installation program from the "
  489.                  "CrossDOS disk. Exiting..."
  490.         )
  491.         (exit
  492.             (quiet)
  493.         )
  494.     )
  495. )
  496.  
  497. ;Initialize certain variables
  498. (set pcdir "")
  499. (set harddisk "")
  500.  
  501. (set @execute-dir
  502.     (expandpath ":")
  503. )
  504.  
  505. ;Check to see whether the user has a c:CDMount. If so, set "prefix"
  506. ;to "CD".
  507.  
  508. (if
  509.     (exists "c:CDMount")
  510.     (set prefix "CD")
  511. )
  512.  
  513. (ConfigureHardDisk)
  514. (exit
  515.     (quiet)
  516. )
  517.  
  518.